package com.example.wangzh.mytest;

import com.example.wangzh.mytest.base.BaseActivity;
import com.example.wangzh.mytest.databinding.ActivityBuchheimAlgorithmBinding;
import com.example.wangzh.mytest.part.buchheim_algorithm.TreeLayout;
import com.example.wangzh.mytest.part.buchheim_algorithm.TreeLayout.Node;

public class BuchheimAlgorithmTestActivity extends BaseActivity<ActivityBuchheimAlgorithmBinding> {
    @Override
    protected void initView() {
        Node root = new Node("root");
        double screenWidth = getResources().getDisplayMetrics().widthPixels;
        root.setXCoord(screenWidth / 2);
        Node a = new Node("a");
        Node b = new Node("b");
        Node c = new Node("c");
        Node d = new Node("d");
        Node e = new Node("e");
        Node f = new Node("f");
        Node g = new Node("g");
        Node h = new Node("h");
        Node i = new Node("i");
        Node j = new Node("j");
        Node k = new Node("k");
        Node l = new Node("l");
        Node m = new Node("m");
        Node n = new Node("n");
        root.addChild(e);
        root.addChild(f);
        root.addChild(n);

        e.addChild(a);
        e.addChild(d);

        n.addChild(g);
        n.addChild(m);

        d.addChild(b);
        d.addChild(c);

        m.addChild(h);
        m.addChild(i);
        m.addChild(j);
        m.addChild(k);
        m.addChild(l);

        TreeLayout treeLayout = new TreeLayout();
        treeLayout.layoutTree(root);
        mBinding.buchheimTreeView.setTree(root);
    }
}
